package com.test.ip;

import org.apache.flink.table.types.DataType;
import org.apache.flink.table.types.DataTypeVisitor;

import java.io.Serializable;
import java.util.List;

/**
 * @create: 2023-07-13 14:16
 * @author: Mr.Du
 * --------------
 * @notes:
 **/
public class IPDataInfo implements Comparable<IPDataInfo> {
    private String ipStart;
    private String ipEnd;
    private long longIpStart;
    private long longIpEnd;
    private String country;
    private String province;

    public IPDataInfo(String ipStart, String ipEnd, long longIpStart, long longIpEnd, String country, String province) {
        this.ipStart = ipStart;
        this.ipEnd = ipEnd;
        this.longIpStart = longIpStart;
        this.longIpEnd = longIpEnd;
        this.country = country;
        this.province = province;
    }


    public String getIpStart() {
        return ipStart;
    }

    public void setIpStart(String ipStart) {
        this.ipStart = ipStart;
    }

    public String getIpEnd() {
        return ipEnd;
    }

    public void setIpEnd(String ipEnd) {
        this.ipEnd = ipEnd;
    }

    public long getLongIpStart() {
        return longIpStart;
    }

    public void setLongIpStart(long longIpStart) {
        this.longIpStart = longIpStart;
    }

    public long getLongIpEnd() {
        return longIpEnd;
    }

    public void setLongIpEnd(long longIpEnd) {
        this.longIpEnd = longIpEnd;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }


    @Override
    public String toString() {
        return "IPDataInfo{" +
                "ipStart='" + ipStart + '\'' +
                ", ipEnd='" + ipEnd + '\'' +
                ", longIpStart=" + longIpStart +
                ", longIpEnd=" + longIpEnd +
                ", country='" + country + '\'' +
                ", province='" + province + '\'' +
                '}';
    }


    @Override
    public int compareTo(IPDataInfo o) {
        // 比较规则 logIpStart大的放后面，小的放前面
        return this.longIpStart > o.longIpStart ? -1 : 1;
    }
}
